package com.john.design.创建性模型.建造者模式.v2;

import com.john.design.创建性模型.建造者模式.CourseBuilder;

/**
 * @Author: JohnCoding
 * @Description:
 * @date: 2020/8/10 23:48
 */
public class Course {
    private String name;

    private String type;

    private String qa;

    private String ppt;

    public Course(CourseBuilder builder) {
        this.name = builder.name;
        this.type = builder.type;
        this.qa = builder.qa;
        this.ppt = builder.ppt;
    }

    @Override
    public String toString() {
        return "Course{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", qa='" + qa + '\'' +
                ", ppt='" + ppt + '\'' +
                '}';
    }
    public static class CourseBuilder {
        private String name;

        private String type;

        private String qa;

        private String ppt;

        public CourseBuilder buildName(String name){
            this.name = name;
            return this;
        }
        public CourseBuilder buildType(String type){
            this.type =type;
            return this;
        }
        public CourseBuilder buildQa(String qa){
            this.qa = qa;
            return this;
        }
        public CourseBuilder buildPpt(String ppt){
            this.ppt = ppt;
            return this;
        }
        public Course build(){
            return new Course(this);
        }
    }
}
